<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<script type="text/javascript" charset="UTF-8" src="/js/formValidator.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8" src="/js/formValidatorRegex.js" charset="UTF-8"></script>
<c:url value="/images" var="imgPath"/>
<script type="text/javascript">
<!--
$().ready( function() {
	$.formValidator.initConfig({formid:"formObj",onerror:function(msg){alert(msg)},onsuccess:function(){return true;}});

	$("#pkey").formValidator().regexValidator({
		regexp:"ascii",datatype:"enum",
		onerror:"英數字不帶空白"});

	$("#saveBtn").click(function() {
		$('#formObj').attr('action','save.do');
		$('#formObj').submit();
	});
})
//-->
</script>
<h1>公司/部门维护</h1>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<s:form name="formObj" action="save.do" method="post" id="formObj">
<s:hidden name="permissionName" id="pName"/>
<br />
<table class="tb-data">
<s:if test="%{obj.modifyDate != null}">
<%-- 修改 --%>
	<tr>
		<th width="30%">代码</th>
		<td>${obj.code}
		<s:hidden name="obj.code" id="pkey"/>
		</td>
	</tr>
</s:if><s:else>
<%-- 新增 僅其他類別可新增 --%>
	<tr>
		<th width="30%">代码</th>
		<td><s:textfield name="obj.code" id="pkey"/></td>
	</tr>
</s:else>
	<tr>
		<th width="30%">说明</th>
		<td><s:textfield name="obj.description"/></td>
	</tr>
	<tr>
		<th width="30%">类别</th>
		<td><s:select list="typeMenu" name="obj.type" listKey="key" listValue="value"/></td>
	</tr>
	<tr>
		<td colspan="2">
			<div class="f-link">
				<input type="button" id="saveBtn" value="储存修改">
<s:if test="%{obj.modifyDate != null}">
				<input type="button" onclick="window.location='view.do'" value="回检视页">
</s:if><s:else>
				<input type="button" onclick="window.location='search.do'" value="回查询页">
</s:else>
			</div>
		</td>
	</tr>
</table>
</s:form>
